#ifndef SESSIONMANAGER_H
#define SESSIONMANAGER_H

#include <qmutex.h>
#include <QMutexLocker>
#include <qmap.h>

class Session;

class SessionManager
{
public:
    static SessionManager *getInstance()
    {
        QMutexLocker locker(&m_mutex);
        if(m_instance == 0)
        {
            m_instance = new SessionManager();
        }
        return m_instance;
    }

    SessionManager();

    ~SessionManager();

    int addSession( Session *session);

    int removeSession(int session_id);

    Session *getSessionByID(int session_id);

    Session *getSessionByFrom(const std::string from);

    bool hasSessionRunning();

private:

    static QMutex m_mutex;


    QMap<int, Session*> *m_sessionList;

    static SessionManager *m_instance;
};

#endif
